#include "stdafx.h"
#include "Input.h"
#include "config/Def.h"

using namespace unigame;

Input* Input::s_instance = 0;

Input* Input::instance()
{
	if(!s_instance)
	{
		s_instance = uni_new Input();
	}
	return s_instance;
}

void Input::destroy()
{
	uni_delete(s_instance);
}

Input::Input():
m_touchNumber(0)
{
	memset(m_keyButtons, 0, sizeof(m_keyButtons));
}

void Input::update()
{
	for(int i = 0; i < m_touchNumber; ++i)
	{
		m_touchs[i].reset();
	}
	m_touchNumber = 0;
	for(int i = 0; i < E_COUNT_MB; ++i)
	{
		m_mouses[i].reset();
	}
	for(int i = 0; i < E_COUNT_KB; ++i)
	{
		m_keyButtons[i] &= E_PRESSING_IA;
	}
}